#pragma once
#include "DoSomethingInAllFiles.h"
class HYToYJK :
	public DoSomethingInAllFiles
{
public:
	struct FuncPara
	{
		CString type;
		CString naPar;
	};

	struct StringPair
	{
		CString sss1;
		CString sss2;
	};

	struct FunctionData
	{
		CString retType;
		CString nameFunc;
		vector<FuncPara> paras;
	};

	vector<CString> m_csCategories;
	vector<CString> m_csParameters;
	vector<CString> m_csParameterGroups;
	vector<CString> m_csPostableCommand;

	dmap<CString, CString> m_ReplacePairs;

	vector<StringPair> m_HeadAddPairs;
	vector<StringPair> m_AddNameSpacePairs;

	bool m_bProjFile = false;

	HYToYJK();
	~HYToYJK();

	virtual bool IsFileValid(CString fileName) override;

	virtual bool Do(CString fileName);
	bool ChangedByLineMain(CString fileName);
	bool IsStringVarIsResultVar(int id, CString varName);
	CString GetVarName(CString string);
	bool IsStringHasEqResult(CString string, int& ids, int& ide);
	bool GetFunctionHead(int id, FunctionData& funcdata);
	bool IsStringLineFunction(int id, FunctionData& funcdata);
	bool IsStringHasRetResult(CString string, int& ids, int& ide);
	void ReplaceToResult(CString& cs);
	bool IsStringBuiltinCategoryOrParameter(CString string, int& ids, int& ide, bool& bCate);
	CString GetCategoryStr(CString csNum);
	CString GetParameterStr(CString csNum);

	void GetCateAndParasDefines();
	void BuiltInCateOrParaDoSomething(CString& string, bool bCate, int ide);
	void GetAllReplacePairs();

	static void ReplaceKeyString(CStdioFile& file, int& id, CStringArray& csReadlines, LPARAM& par);
	void IsStringNeedGet_Item(CString& string);
	void CatogoryNumberStrTo(CString& string, CString numCate);
	void ElementCategoryFilter(CString& string);
	void GetCatogoryString(CString& string, CString csKey, CString csTail);
	void UsingEnumeratorTo(CString& string);
	CString GetParaGroupsStr(CString csNum);
	void ParaGroupNumberStrTo(CString& string, CString numParaGrp);
	void GetParaGroupString(CString& string, CString csKey, CString csTail);
	void GetParameterString(CString& string, CString csKey, CString csTail);
	void ParameterNumberStrTo(CString& string, CString numParaGrp);
	void SetLineWeight(CString csKey, CString& string, CString csEnumAdd);
	void Domain(CString csKey, CString& string, CString csEnumAdd);
	void csprojChangeSth(CString& string);
	void numStringToEnum(CString& string, CString csStart, CString csEnd, CString csEnumAdd);
	void numStringToEnum(CString& string, CString csKey, CString csStart, CString csEnd, CString csEnumAdd);
	bool GetNumString(CString string, int ids, int ide, CString& csNum);
	void ChangedCSProjByLineMain(CString fileName);
	void SetUsableView(CString& string);
	CString GetPostableCommandStr(CString csNum);
	void PostableCommandNumberStrTo(CString& string, CString numPostableCommand);
	void GetPostCommandString(CString& string, CString csKey, CString csTail);
	bool IsFindHeadNumber(int ide, CString& string, CString csTail);
	void AddStringToKeyString(CString& string, CString csKey, CString csPre);
	void AddPreStringToKeyString(CString& string, CString csPre, CString csKey);
	//void AddStringPairs(CString sss1, CString sss2, vector<StringPair>& pairs);
	void AddIntToViewType(CString csKey, CString& string);
	void AddIntToViewTypeLeft(CString csKey, CString& string, bool bFindEq);
	void AddIntToViewTypeRight(CString csKeyRight, CString& string);
	void AddClassNameSpace(CString& string, CString csKey, CString csNameSpace);

	void AddHeadNameSpace(CString csKey, CString &string, CString csNameSpace);

	void FunctionIntAddnamesPace(CString& string, CString csKey, CString csEnumAdd, int idPara = -1);
	bool IsComaInNewXYZ(CString string, int idComa);

	void TestFunction();
	int FindLastIndex(CString string, CString csStart, CString csEnd, int ide);
	void LoadFamilyRef(CString csKey, CString& string);
	void IntersectComparisonToAddInt(CString& string);
	void AddHeadApplication(CString& string);
	bool m_bCheckProj;

	bool m_bCheckCS;

	bool m_bReplaceAll;
	bool m_bCategory;
	bool m_bToken;
	bool m_bOtherChange;
};
